/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "QLTTB_GRUPO_VARIAVEL")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "GrupoVariavel.findAll", query = "SELECT g FROM GrupoVariavel g"),
    @NamedQuery(name = "GrupoVariavel.findByGpvId", query = "SELECT g FROM GrupoVariavel g WHERE g.gpvId = :gpvId"),
    @NamedQuery(name = "GrupoVariavel.findByGpvNm", query = "SELECT g FROM GrupoVariavel g WHERE g.gpvNm = :gpvNm"),
    @NamedQuery(name = "GrupoVariavel.findByGpvDs", query = "SELECT g FROM GrupoVariavel g WHERE g.gpvDs = :gpvDs")})
public class GrupoVariavel implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "GPV_ID")
    private BigDecimal gpvId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 104)
    @Column(name = "GPV_NM")
    private String gpvNm;
    @Size(max = 4000)
    @Column(name = "GPV_DS")
    private String gpvDs;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "varGpvId")
    private List<Variavel> variavelList;

    public GrupoVariavel() {
    }

    public GrupoVariavel(BigDecimal gpvId) {
        this.gpvId = gpvId;
    }

    public GrupoVariavel(BigDecimal gpvId, String gpvNm) {
        this.gpvId = gpvId;
        this.gpvNm = gpvNm;
    }

    public BigDecimal getGpvId() {
        return gpvId;
    }

    public void setGpvId(BigDecimal gpvId) {
        this.gpvId = gpvId;
    }

    public String getGpvNm() {
        return gpvNm;
    }

    public void setGpvNm(String gpvNm) {
        this.gpvNm = gpvNm;
    }

    public String getGpvDs() {
        return gpvDs;
    }

    public void setGpvDs(String gpvDs) {
        this.gpvDs = gpvDs;
    }

    @XmlTransient
    public List<Variavel> getVariavelList() {
        return variavelList;
    }

    public void setVariavelList(List<Variavel> variavelList) {
        this.variavelList = variavelList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (gpvId != null ? gpvId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GrupoVariavel)) {
            return false;
        }
        GrupoVariavel other = (GrupoVariavel) object;
        if ((this.gpvId == null && other.gpvId != null) || (this.gpvId != null && !this.gpvId.equals(other.gpvId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.gov.ana.service.GrupoVariavel[ gpvId=" + gpvId + " ]";
    }
    
}
